A Size-Aware Type System with Algebraic Data Types With proofs of soundness and decidability
نویسندگان
چکیده
We present a size-aware type system for a first-order functional language with algebraic data types, where types are annotated with polynomials over size variables. We define how to generate typing rules for each data type, provided its user defined size function meets certain requirements. As an example, a program for balancing binary trees is type checked. The type system is shown to be sound with respect to the operational semantics in the class of shapely functions. Type checking is shown to be undecidable, however, decidability for a large subset of programs is guaranteed.
منابع مشابه
Size Analysis of Algebraic Data Types
We present a size-aware type system for a first-order functional language with algebraic data types, where types are annotated with polynomials over size variables. We define how to generate typing rules for each data type, provided its user defined size function meets certain requirements. As an example, a program for balancing binary trees is type checked. The type system is shown to be sound...
متن کاملAdding Type Constructor Parameterization to Java
We present a generalization of Java’s parametric polymorphism that enables parameterization of classes and methods by type constructors, i.e., functions from types to types. Our extension is formalized as a calculus called FGJω. It is implemented in a prototype compiler and its type system is proven safe and decidable. We describe and motivate our extension through two examples: the definition ...
متن کاملPhantom Types
Phantom types are data types with type constraints associated with different cases. Examples of phantom types include typed type representations and typed higher-order abstract syntax trees. These types can be used to support typed generic functions, dynamic typing, and staged compilation in higher-order, statically typed languages such as Haskell or Standard ML. In our system, type constraints...
متن کاملSize Analysis with Indexed Families of max 0 - Polynomials ?
Our previous work studied a size-aware type system for functional programs with non-monotonic polynomial size dependencies. In that approach output sizes depended only on input sizes. That is rather restrictive since in many cases the size of the output can differ for different input data of the same size. In this paper we remove that limitation by presenting value-sensitive size dependencies v...
متن کاملSound and Complete Bidirectional Typechecking for Higher-Rank Polymorphism with Existentials and Indexed Types
Bidirectional typechecking, in which terms either synthesize a type or are checked against a known type, has become popular for its scalability, its error reporting, and its ease of implementation. Following principles from proof theory, bidirectional typing can be applied to many type constructs. The principles underlying a bidirectional approach to indexed types (generalized algebraic datatyp...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2008